var redisModel = require('../lib/redis');

module.exports = {
    checkLogin: function checkLogin(req, res, next) {
        if (req.session.name == null) {
            return res.redirect('/user');
        }
        redisModel.setExpire(req.session.name);
        next();
    },
    checkAdminLogin: function checkAdminLogin(req, res, next) {
        if (req.session.admin != 2) {
            return res.redirect('/user')
        }
        redisModel.setExpire(req.session.name);
        next();
    }
};
